/*
** 3100_math_helped.c
** 
** Made by (seakage2h)
** Login   <seakage2h@seakage2h-ubuntu>
** 
** Started on  Sat Sep 13 21:26:56 2008 seakage2h
** Last update Sun May 12 01:17:25 2002 Speed Blue
*/

/* #include "3100_math_helped.h" */
#include <stdio.h>
#include <math.h>

int main()
{
     int b, n;
     double frac_pow;
     double d_res;
     int lower, upper, app_n_upper, app_n_lower;
     int i;
     
     while(1){
	  scanf("%d%d", &b, &n);
	  if (b + n == 0) break;

	  app_n_lower = app_n_upper = 1;
	  frac_pow = 1.0/(double)n;
	  d_res = pow((double)b, frac_pow);
	  lower = floor(d_res);
	  upper = ceil(d_res);
	  for(i = 0; i < n; i++){
	       app_n_upper *= upper;
	       app_n_lower *= lower;
	  }
	  
	  printf("%d\n", (b - app_n_lower > app_n_upper - b)?upper:lower);
     }

     return 0;
}
